package net.koodar.forge.system.user.model.dto;

import lombok.Getter;
import lombok.Setter;
import net.koodar.forge.common.domain.dto.DTO;
import net.koodar.forge.system.role.model.entity.UserRole;

import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

/**
 * @author liyc
 */
@Getter
@Setter
public class UserParamDTO extends DTO {

	private Long userId;

	private String username;

	private String nickname;

	private String email;

	private String avatar;

	private String description;

	private Long departmentId;

	private Set<Long> roleIds;

	public List<UserRole> toUserRoles () {
		return this.roleIds.stream()
				.map(roleId -> new UserRole(userId, roleId))
				.collect(Collectors.toList());
	}
}
